import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../constant/my_color.dart';
import '../../util/base_utils.dart';
import '../../util/font_utils.dart';

class MyConfirmDialogWidget extends StatelessWidget {
  String title;
  String subTitle;
  String sureTitle;
  Function sureCallback;
  TextStyle? titleTextStyle;
  TextStyle? subTextStyle;
  TextStyle? sureTitleTextStyle;
  Color? sureBackgroundColor;

  MyConfirmDialogWidget(
      this.title, this.subTitle, this.sureTitle, this.sureCallback,
      {Key? key,
      this.titleTextStyle,
      this.subTextStyle,
      this.sureTitleTextStyle,this.sureBackgroundColor})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding:
          EdgeInsets.only(left: 20.w, right: 20.w, top: 35.w, bottom: 20.w),
      decoration: BoxDecoration(
          color: Colors.white, borderRadius: BorderRadius.circular(26.w)),
      child: Column(
        children: [
          Text(
            title,
            style: titleTextStyle ??
                getTextStyle(32.sp,
                    fontType: FontType.DEFAULT, color: Colors.black),
          ).setContainer(margin: EdgeInsets.only(bottom: 18.w)),
          Text(
            subTitle,
            style: subTextStyle ?? getTextStyle(20.sp, color: Colors.black),
          ),
          Container(
            width: double.infinity,
            margin: EdgeInsets.only(left: 40.w, right: 40.w, top: 60.w),
            padding: EdgeInsets.only(top: 6.w, bottom: 5.w),
            alignment: Alignment.center,
            decoration: BoxDecoration(
                color: sureBackgroundColor ?? MyColors.brow_2551520,
                borderRadius: BorderRadius.circular(24.w)),
            child: Text(
              sureTitle,
              style: sureTitleTextStyle ??
                  getTextStyle(20.sp, color: Colors.white),
            ),
          ).setOnClickListener(() {
            sureCallback();
          })
        ],
      ),
    );
  }
}
